<?php
// fenetre modale colorbox et tooltip fonctionnent avec vendor/jquery.1.10.1
//queue_js_file('jquery/1.10.2/jquery.min');
queue_css_file('colorbox');
queue_js_file('jquery.colorbox');
queue_js_string('
	$(document).ready(function(){
		$(".iframe").colorbox({iframe:true, width:"100%", height:"100%"});
		$(".tooltip").tooltipster({
			theme: "tooltipster-shadow",
			contentAsHTML: true,
			interactive: true,
			position: "top"
		});
		$(".tooltipajax").tooltipster({
			contentAsHTML: true,
			interactive: true,
			content: "Loading...",
			theme: "tooltipster-shadow",
			position: "top",
			functionBefore: function(origin, continueTooltip) {
				// we ll make this function asynchronous and allow the tooltip to go ahead and show the loading notification while fetching our data
				continueTooltip();
				// next, we want to check if our data has already been cached
				if (origin.data("ajax") !== "cached") {
					$.ajax({
						type: "POST",
						url: "'.WEB_ROOT.'/tooltip/get/dbpedia?url="+$(this).attr("href"),
						success: function(data) {origin.tooltipster("content", data).data("ajax", "cached");}
					});
				}
			}
		});
	});
');
// chargement header
echo head(array('title' => metadata('item', array('Dublin Core', 'Title')),'bodyclass' => 'items show'));
?>

<h1><?php echo metadata('item', array('Dublin Core', 'Title')); ?></h1>

<div id="primary">

	<?php if ((get_theme_option('Item FileGallery') == 0) && metadata('item', 'has files')): ?>
	<?php
	// thumbnail, square_thumbnail, fullsize
	echo files_for_item(array('imageSize' => 'fullsize'));
	?>
	<?php endif; ?>

<?php /* Dublin core + itemtype modify in /common/record-metadata.php */
	echo all_element_texts('item');
	?>

	<div>
		<table class="meta-table">
		<?php if (metadata('item', 'has tags')): ?>
		<tr>
			<td class="meta-title"><?php echo __('Tags'); ?></td>
			<td class="meta-value">
				<?php echo tag_string('item'); ?>
			</td>
		</tr>
		<?php endif; ?>
		<tr>
			<td class="meta-title"><?php echo __('Citation'); ?></td>
			<td class="meta-value">
				<?php
				//echo metadata('item', 'citation', array('no_escape' => true));
				echo custom_item_citation();
				?>
			</td>
		</tr>
		</table>
	</div>

	<?php fire_plugin_hook('public_items_show', array('view' => $this, 'item' => $item)); ?>

</div><!-- end primary -->

<aside id="sidebar">

    <?php
    // The following returns all of the files associated with an item.
    if (get_theme_option('Item FileGallery') == 1): ?>
    <div id="itemfiles" class="element">
        <h2><?php echo __('Files'); ?></h2>
        <?php
        if (metadata('item', 'has files')) echo custom_item_image_gallery($attrs = array(), $imageType = 'thumbnail', $filesShow = true, $item = null)['html'];
        else echo 'Pas de fichier associé à cet item.';
        ?>
    </div>
    <?php endif; ?>

    <?php
    // If the item belongs to a collection, the following creates a link to that collection.
    if (metadata('item', 'Collection Name')): ?>
    <div id="collection" class="element">
        <h2><?php echo __('Collection'); ?></h2>
        <div class="element-text"><p><?php echo link_to_collection_for_item(); ?></p></div>
    </div>
    <?php endif; ?>

</aside>

<ul class="item-pagination navigation">
    <li id="previous-item">
    	<?php echo link_to_previous_item_show('<div class="previous-arrow"></div> Précédent'); ?>
    </li>
    <li id="next-item" class="next">
    	<?php echo link_to_next_item_show('Suivant <div class="next-arrow"></div>'); ?>
    </li>
</ul>

<?php echo foot(); ?>

